<template>
  <view class="">
    <view class="flex-col section_1">
        <view class="justify-center group_7">
          <image
            src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558030319391953198.png"
            class="image_11"
            @click="onClickImage"
          />
          <text class="text_3">分销中心</text>
        </view>
      <view class="justify-between group">
        <view class="flex-col items-end group_1">
          <view class="flex-col section_2">
            <view class="flex-row group_2">
              <image
                :src="avatar"
                class="image_2"
              />
              <view class="flex-col items-start group_3">
                <text class="text">{{nikeName}}</text>
                <text class="text_1" v-if="!referrer">推荐人：无</text>
                <text class="text_1" v-else>推荐人：{{referrer}}</text>

              </view>
            </view>
          </view>
        </view>
        <!-- <view class="flex-col group_4">
          <view class="flex-col items-start group_5">
            <view class="flex-col items-center group_6">
              <view class="flex-row section_3" @click="team">
                <image
                  src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558047521787553488.png"
                  class="image_8"
                />
                <text class="text_2">我的团队</text>
              </view>
            </view>
          </view>
        </view> -->
      </view>

    </view>
    <view class="flex-col section_4">
      <view class="flex-row">
        <view class="flex-col items-center equal-division-item">
          <text class="text_4">已提现 (元)</text>
          <text class="text_6">0.00</text>
        </view>
        <view class="flex-col items-center equal-division-item">
          <text class="text_4">未结算 (元)</text>
          <text class="text_6">0.00</text>
        </view>
        <view class="flex-col items-center equal-division-item">
          <text class="text_4">可提现 (元)</text>
          <text class="text_6">{{withdrawDeposit}}</text>
        </view>
      </view>
    </view>
    <view class="flex-col section_5">
      <view class="flex-col">
        <view class="flex-row group_12">
          <image
            src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558030332466756707.png"
            class="image_12"
          />
          <text class="text_12">推广分销</text>
        </view>
        <view class="grid">
          <view class=" grid-item" @click="order">
            <image
              src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558047540785795138.png"
              class="image_13"
            />
            <view class="flex-col items-start group_14">
              <text class="text_13">分销订单</text>
              <text class="text_15">{{ distributionOrderCount }}笔</text>
            </view>
          </view>
          <view class=" grid-item"  @click="team">
            <image
              src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558047540781714925.png"
              class="image_13"
            />
            <view class="flex-col items-start group_14">
              <text class="text_13">我的团队</text>
              <text class="text_15">{{ myTeamCount }}人</text>
            </view>
          </view>
          <view class=" grid-item"  @click="detail">
            <image
              src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558047518634745914.png"
              class="image_13"
            />
            <view class="flex-col items-start group_14">
              <text class="text_13">提现明细</text>
              <text class="text_15">{{ withdrawalDetailCount }}笔</text>
            </view>
          </view>
          <view class=" grid-item" @click="code">
            <image
              src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558047540792377005.png"
              class="image_13"
            />
            <view class="flex-col items-start group_14">
              <text class="text_13">推广分享</text>
              <text class="text_15">领取推广海报</text>
            </view>
          </view>
        </view>
      </view>
      <view class="flex-col items-center button" @click="onClickView_8"><text class="text_27">立即提现</text></view>
    </view>
  </view>
</template>

<script>
    import {getreferees, getDistributionCenter} from '../../api/index.js'
  export default {
    components: {},
    data() {
      return {
          nikeName:'名称', //名称
          avatar:'' ,//头像
          referrer:'推荐人', //推荐人
          withdrawDeposit:0,//可提现
        distributionOrderCount: 0,//分销订单数量
        myTeamCount: 0,//我的团队数量
        withdrawalDetailCount: 0//提现明细数量
      };
    },
    onLoad() {
      this.getDistributionCenter()
        // let that=this
        // console.log(this.$store.state.userInfo.wxInfo);
        // this.nikeName=this.$store.state.userInfo.wxInfo.nikeName
        // this.avatar=this.$store.state.userInfo.wxInfo.avatar
        // getreferees().then(res=>{
        //     console.log(res);
        //     that.referrer=res.data.nickName
        //     that.withdrawDeposit=res.data.nowMoney
        //     console.log(that.referrer);
        // })
    },
    methods: {

      getDistributionCenter() {
        getDistributionCenter().then(res => {
          console.log('res', res)
          this.avatar = res.data.wxAvatar
          this.nikeName = res.data.nickName
          this.referrer = res.data.spreadNickName
          this.withdrawDeposit = res.data.balance
          this.distributionOrderCount = res.data.distributionOrderCount
          this.myTeamCount = res.data.myTeamCount
          this.withdrawalDetailCount = res.data.withdrawalDetailCount
        })
      },

      onClickImage() {
        uni.navigateBack();
      },
      order() {
        uni.navigateTo({ url: '/pages/distribution/order' });
      },
      commission(){
          uni.navigateTo({
              url: '/pages/distribution/commission' ,
              });
      },

      team() {
        uni.navigateTo({ url: '/pages/distribution/team' });
      },

      detail() {
        uni.navigateTo({ url: '/pages/distribution/detail' });
      },

      code() {
        uni.navigateTo({ url: '/pages/distribution/code' });
      },


      onClickView_8() {
        uni.showToast({
          title: '暂未开放该功能！',
          icon: 'none'
        })
        return
        uni.navigateTo({ url: '/pages/tixian/tixian' });
      },
    },
  };
</script>
<style>
    page{
        background-color: #f5f5f5;
    }
</style>
<style scoped lang="css">
  .equal-division-item {
    flex: 1 1 6.88rem;
    padding: 0.31rem 0;
  }
  .image_3 {
    width: 0.84rem;
    height: 0.47rem;
  }
  .grid-item {
    display: flex;
    width: 35vw;
    background-color: #fff;
    margin:70rpx 0 0;
    padding: 0;
    border-radius: 0;
  }
  button::after{
      border: none;
  }
  .image_13 {
    width: 2.13rem;
    height: 2.14rem;
  }
  .text_4 {
    color: #6b6a77;
    font-size: 0.75rem;
    font-family: SourceHanSansCN;
    line-height: 0.81rem;
  }
  .text_13 {
    color: #333333;
    font-size: 0.81rem;
    font-family: SourceHanSansCN;
    font-weight: 500;
    line-height: 0.78rem;
  }
  .text_6 {
    margin-top: 0.69rem;
    color: #333333;
    font-size: 1.06rem;
    font-family: SourceHanSansCN;
    font-weight: 500;
    line-height: 0.78rem;
  }
  .group_14 {
    margin: 0.11rem 0 0.11rem 0.56rem;
  }
  .text_15 {
    margin-top: 0.41rem;
    color: #999999;
    font-size: 0.75rem;
    font-family: SourceHanSansCN;
    line-height: 0.72rem;
  }
  .page {
    padding-bottom: 25.38rem;
    background-color: #f5f5f5;
    height: 100%;
    border-bottom: solid 0.28rem #ffffff;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
  }
  .section_1 {
    padding: 2.06rem 0 0.53rem;
    background:  url("@/static/oder/fenxiao2.png")no-repeat center center;
    background-size: 100% 100%;
    height: 15.28rem;
  }
  .section_4 {
    margin: -7.5rem 1.41rem 0;
    padding: 1.47rem 0 3.88rem;
    border-radius: 0.31rem;
    background-image: url('https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558047516527461012.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    position: relative;
  }
  .section_5 {
    padding: 1.5rem 0 3.66rem;
    background-color: #ffffff;
    position: absolute;
    left: 0.94rem;
    right: 0.94rem;
    top: 13.31rem;
  }
  .group {
    margin-left: -1.38rem;
    align-self: flex-start;
    width: 23.88rem;
  }
  .group_7 {
    padding: 0 0.97rem 0.16rem;
    position: relative;
  }
  .button {

    padding: 0.91rem 0 0.88rem;
    background-color: #2F8BF2;
    border-radius: 1.31rem;
    position: fixed;
    width: 90vw;
    left: 5vw;
    bottom: 30rpx;
  }
  .group_1 {
    padding: 1.38rem 0 6.81rem;
    width: 14.38rem;
    position: relative;
  }
  .group_4 {
    margin-top: 2rem;
    width: 5.47rem;
  }
  .image_11 {
    position: absolute;
    left: 0.97rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.63rem;
    height: 1.06rem;
  }
  .text_3 {
    color: #ffffff;
    font-size: 1.06rem;
    font-family: SourceHanSansCN;
    font-weight: 500;
    line-height: 1rem;
  }
  .group_12 {
    padding: 0 0.91rem;
  }
  .grid {
    margin-top: 0.64rem;
   display: flex;
   justify-content: space-around;
   flex-wrap: wrap;
  }
  .text_27 {
    color: #ffffff;
    font-size: 0.88rem;
    font-family: SourceHanSansCN;
    font-weight: 500;
    line-height: 0.84rem;
  }
  .image {
    width: 3.53rem;
    height: 3.59rem;
  }
  .image_1 {
    width: 11.38rem;
    height: 11.38rem;
    position: absolute;
    right: 0.22rem;
    top: 0;
  }
  .section_2 {
    padding: 1.38rem 0.31rem 1.41rem 2.31rem;
    background-image: url('https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558047507441508973.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    position: absolute;
    left: 0;
    top: 0.41rem;
  }
  .group_5 {
    position: relative;
  }
  .image_10 {
    margin-top: 4.81rem;
    align-self: flex-end;
  }
  .image_12 {
    width: 0.31rem;
    height: 0.94rem;
  }
  .text_12 {
    margin-left: 0.34rem;
    color: #333333;
    font-size: 1rem;
    font-family: SourceHanSansCN;
    font-weight: 500;
    line-height: 0.94rem;
  }
  .group_2 {
    padding-left: 0.44rem;
  }
  .image_4 {
    margin-top: 6.06rem;
    align-self: flex-start;
  }
  .group_6 {
    padding-top: 0.47rem;
    width: 5rem;
    position: relative;
  }
  .image_9 {
    width: 0.34rem;
    height: 0.69rem;
    position: absolute;
    right: 0.75rem;
    bottom: 0.47rem;
  }
  .image_2 {
    width: 2.06rem;
    height: 2.06rem;
  }
  .group_3 {
    margin-left: 0.44rem;
    margin-bottom: 0.13rem;
  }
  .image_5 {
    width: 2.63rem;
    height: 2.63rem;
  }
  .image_6 {
    width: 3.13rem;
    height: 1.81rem;
    position: absolute;
    right: 0.63rem;
    bottom: 0.47rem;
  }
  .image_7 {
    width: 2.19rem;
    height: 2.19rem;
    position: absolute;
    right: 0.94rem;
    bottom: 0.19rem;
  }
  .section_3 {
    padding: 0.53rem 0.56rem 0.5rem 0.66rem;
    background-color: #96a3ff;
    box-shadow: inset 0px 0.031rem 0.094rem #ffffff6b;
    background-image: linear-gradient(-90deg, #7e7cff 0%, #bab6ff 100%);
    border-radius: 0.88rem;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
  }
  .text {
    color: #ffffff;
    font-size: 0.88rem;
    font-family: SourceHanSansCN;
    line-height: 0.84rem;
  }
  .text_1 {
    margin-top: 0.38rem;
    color: #cbc7ff;
    font-size: 0.69rem;
    font-family: SourceHanSansCN;
    line-height: 0.66rem;
  }
  .image_8 {
    flex-shrink: 0;
    width: 0.56rem;
    height: 0.66rem;
  }
  .text_2 {
    margin-left: 0.22rem;
    color: #ffffff;
    font-size: 0.75rem;
    font-family: SourceHanSansCN;
    line-height: 0.69rem;
  }
</style>
